Charge measurement in a system using a pulse frequency modulated DC-DC converter

ABSTRACT

The charge drawn from a battery during each switching event (pulse) of a pulse frequency modulated DC-DC converter is determined during a calibration period. based on differences in pulse rate with different current loading. Another approach calibration approach determines charge drawn from the battery by measuring voltage across a sense resistor while measuring the total pulse rate and while adding sufficient load current to ensure that the voltage is much larger than the residual offset of the measurement system. During operation, the system counts number of pulses are counted and the total charge drawn from the battery is determined based, at least in part, on the charge transferred per pulse during calibration, the operational mode, the battery voltage during calibration and operationally and the output voltage. Based on the total charge drawn and temperature (for temperature dependent battery types), the battery state of charge is estimated.

RELATED APPLICATION

This application relates to U.S. patent application Ser. No. 15/392,475,entitled “Charge Measurement Calibration In A System Using A PulseFrequency Modulated DC-DC Converter”, naming Jeffrey L. Sonntag, TimothyJ. Dupuis, and Jinwen Xiao as inventors, and filed the same day as thepresent application, which application is incorporated by referenceherein in its entirety.

BACKGROUND Field of the Invention

This invention relates to charge measurement for use in determiningstate of charge in a battery.

Description of the Related Art

Traditional coulomb counting has been used to predict the remainingcharge in a battery and has been widely used in conjunction withLithium-Ion batteries for such prediction. Traditional coulomb countingis based on the integration of the measured voltage drop (IR drop)across a small resistor in series with the power supply. However,further improvements in determining charge transferred from a battery toaddress a variety of battery technologies and environments aredesirable.

SUMMARY OF EMBODIMENTS OF THE INVENTION

In one embodiment, a method includes determining, based on a calibrationoperation, a calibration charge drawn per pulse from a battery supplyingan input voltage to a pulse frequency modulated (PFM) DC-DC converter,during at least a part of which calibration operation a calibrationcurrent load is added to a system current load of the PFM DC-DCconverter. During operation, an operational battery voltage isdetermined. During operation, a number of pulses is counted, the pulsescorresponding to switching events that occur in the PFM DC-DC converterand are associated with the operational battery voltage. The chargedrawn from the battery during the number of pulses is determined, basedat least in part on the operational battery voltage, the calibrationcharge drawn per pulse, and the number of pulses.

In another embodiment, an apparatus includes a pulse frequency modulated(PFM) DC-DC converter. Logic is configured to determine, based on acalibration operation, a calibration charge drawn per pulse from abattery supplying an input voltage to the PFM DC-DC converter. Acalibration current load is controlled to be added to a system currentload during at least a part of the calibration operation to provide anincreased current load seen by the PFM DC-DC converter. A counter countsa number of pulses corresponding to switching events that occur in thePFM DC-DC converter during operation associated with an operationalbattery voltage. The logic is further configured to determine chargedrawn from the battery during the number of pulses, based at least inpart, on the operational battery voltage, the calibration charge drawnper pulse, and the number of pulses.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention may be better understood, and its numerousobjects, features, and advantages made apparent to those skilled in theart by referencing the accompanying drawings.

FIG. 1 illustrates a top level view of a charge measuring systemaccording to an embodiment.

FIG. 2A illustrates an embodiment of the calibration logic used todetermine charge drawn per PFM pulse.

FIG. 2B illustrates an embodiment of a current load added duringcalibration.

FIG. 2C illustrates an embodiment in which maximum, minimum, and averageinformation is maintained for the battery voltage.

FIG. 3 illustrates a flow chart illustrating operation of thecalibration hardware.

FIG. 4 illustrates another embodiment for calibrating charge drawn perpulse based on a measured voltage drop (IR drop) across a small resistorin series with the power supply while a current load has been added tothe system.

FIG. 5 shows a flow chart illustrating operation of the embodimentmeasuring IR drop in conjunction with added calibration current load.

FIG. 6 illustrates a different perspective of a top level view of acharge measuring system according to an embodiment.

The use of the same reference symbols in different drawings indicatessimilar or identical items.

DETAILED DESCRIPTION

FIG. 1 illustrates a top level view of a system according to anembodiment of the present invention. The pulse frequency modulation(PFM) DC-DC converter 101 converts an input voltage Vbat 103 from abattery 104 to an output voltage Vout 107, utilizing a series of pulseswitching events in the inductor. Each pulse event transfers an amountof charge from the battery that depends generally on the value ofinductor 109, the battery voltage Vbat, the output voltage Vout, theoperating mode, and the peak current (Ipk) allowed in the switchingoperation. During a calibration operation, the charge transferred duringeach switching event or pulse is determined. The charge transferredduring calibration may then used together with current operatingconditions such as battery voltage, output voltage, and operating modeto determine a charge transferred per pulse operationally. By countingswitching events, and monitoring temperature, the total chargetransferred from the battery may be determined and the state of charge(or remaining battery lifetime) may be estimated based on the totalcharge drawn and the battery capacity. As used herein, battery capacityrefers to the total amount of charge that can be drawn from a newbattery. Battery state of charge refers to the remaining amount ofcharge that can be drawn from the battery.

Several different approaches for determining the charge transferredduring each calibration switching event (also referred to herein as apulse) are described. One approach for determining charge drawn from thebattery per pulse during calibration measures change in the pulse ratewith a change in current loading. In another embodiment, the calibrationoperation measures battery current during a calibration period whilemeasuring the total pulse rate and while adding sufficient load currentto ensure that the total IR drop is much larger than the possibleresidual offset of the measurement system.

Once the charge transferred per switching event is determined for acalibration operation, during operation an operational chargetransferred per switching event may be determined based on thecalibration data and current operating parameters of the DC-DC converteras described further herein. The number of switching eventsoperationally may be counted and the total charge drawn from the batterymay be determined as (the number of switching events)×(the chargetransferred per switching event). Based on the total charge drawn and insome embodiments the temperature (particularly for temperature dependentbattery types), the battery state of charge may be estimated.

Referring still to FIG. 1, calibration logic 121 (an embodiment of whichis shown in more detail in FIG. 2A) receives DC-DC converter informationsuch as operational mode (e.g., buck, boost, buck-boost), input voltageduring calibration, and the output voltage during calibration. Thecalibration logic determines calibration information related to chargedrawn per pulse, which is supplied to computation and control logic 119.The calibration logic 121, described in more detail herein, may becontrolled by the computation and control logic 119, which may be usedto compute how much charge is transferred in each pulse (Q_(batCal))during calibration.

The calibration information (charge drawn per pulse during calibrationor information from which charge drawn per pulse during calibration maybe calculated), as described further herein, along with certain currentoperating parameters (e.g., Vbat, mode, and Vout), are then used todetermine charge drawn per pulse operationally (Q_(batOp)). BecauseQ_(batOp) is a function of the battery voltage during operation,Q_(batOp) changes as the battery discharges and computation and controllogic 119 should receive updated battery voltage data during operationin order to keep the Q_(batOp) estimate accurate.

Referring still to FIG. 1, the pulse counter 111 counts switching eventsoperationally, and in an embodiment, counts modulo 2^(N), where N issufficiently large so that the counter rolls over no more than oncebetween sequential accesses of the snapshot register 115 by thecomputation process. In an embodiment, the counter may be a four bytecounter or any other appropriate size for the application. The snapshotregister 115 transcribes a copy of the value of the pulse counter foraccess by the communication interface 117 and ensures that the pulsecount value supplied to the communication interface is not transitioningat the time it is supplied. The communication interface 117 can be aserial interface for chip to chip communication such as an I²C bus orthe Serial Peripheral Interface (SPI) bus, or even a wirelesscommunication interface. In other embodiments, the communicationinterface may be custom and may be utilized for intra-chipcommunication. The number of pulses counted along with the determinationof charge drawn per pulse operationally (Q_(batOp)) may be used todetermine the charge drawn for the pulses counted, which may in turn beused to determine the battery state of charge.

In an embodiment, the computation and control logic 119 supplies outputregister 123 with the total charge drawn from the battery for the pulsecount read and output register 125 with the remaining capacity (batterystate of charge), as described further herein. Computation and controllogic maintains a total charge drawn from the battery in order tocompute the battery state of charge. Remaining capacity may be expressedas remaining battery charge, or some fraction of the original nominalbattery charge. However, the usable remaining battery charge may besignificantly different than the total remaining battery charges formany battery chemistries. For alkaline batteries at 0 degrees C., forexample, the usable charge might be zero, though the remaining charge is50% of the original capacity. When restored to room temperature, most ofthe remaining charge becomes usable. So, in modelling how the batterywill behave in the future at the current temperature, knowing thecurrent temperature can be important in determining useable remainingcharge. Thus, computation and control logic 119 may take temperatureinto consideration in determining usable remaining charge and provideusable remaining battery charge, total remaining battery charge, orboth, as battery state of charge. Note that the computation and controllogic 119 may be implemented as software running on programmable logicsuch as a microcontroller (MCU), or may be implemented as hardware, oras a combination of hardware and programmed logic.

Before various embodiments are described, some shortcomings intraditional approaches to coulomb counting are explored. One problemwith traditional coulomb counting is that any offset remaining in themeasurement process is an error, which is integrated across thedischarge time of the battery. If the discharge time is long (years),even a very small error in offset can become a large error in themeasured charge. Thus, for systems where the battery lifetime is meantto be multiple years, traditional coulomb counting has shortcomings. Inaddition, the IR drop should be very small so that only a smallpercentage of system power is consumed by the IR drop measurement.

Another problem with the traditional approach is that the measurementsmust be high resolution (the voltage drop on the reference resistor mustbe small for efficiency) and must be done at a reasonably high bandwidthand sampling rate. Modern systems may sleep for a high duty cycle andthen draw substantial power at a very low duty cycle. Even with areasonably high bandwidth and sampling rate, measurements made forsystems that draw substantial power at very low duty cycles may easilymiss the pulse of drawn power entirely. Further, the high resolutionmeasurement and the bandwidth and sampling rate requirements areincompatible with extremely low power consumption. Therefore, the IRmeasurement system draws more power than would be desired. Again, thisis worse for systems that must operate on a single charge for years andcan result in the total charge used by the measurement system becominglarge relative to the total battery charge.

So while traditional coulomb counting works reasonably well for systemswhich discharge in a few days, such as a modern cell phone, it canbecome hopelessly inaccurate in systems that discharge in months oryears.

Another approach for estimating battery state of charge is to measurethe open circuit voltage (OCV) and look up the state of charge on adischarge curve. However, discharge curves change as a function oftemperature, manufacturer, and loading/pulse conditions. Additionally,estimating OCV from the behavior of a system that is not turned off ishard. Also, for some battery types, the change in output voltage withremaining capacity has very wide flat regions, where remaining capacitycannot be predicted. One battery type popular in metering applications,Lithium Thionyl Chloride, has a discharge curve which remains flat untilthe last 10% or so of battery capacity remaining. The desire forremaining lifetime estimation for these battery types is not addressedby OCV battery voltage measurement or IR based coulomb counters.

One additional problem is the concept of coulomb counting itself. Forsome battery types (e.g., Lithium Ion batteries), the battery can beseen as a nearly ideal capacitor, with the same charge available to bedrawn, regardless of temperature. In this case, calculating total chargedrawn is a good way to estimate state of charge. However, many otherbattery types (e.g., alkaline), including most non-rechargeable batterytypes, in contrast, have extreme temperature dependence, with currentdrawn at low temperatures causing large voltage drops, which preventoperation of the powered circuits, despite substantial charge remainingin the battery. Predicting the remaining usable capacity at the current(or other) temperature demands not just simple subtraction of the totalused charge from the initial rated charge, but modelling of how thebattery internal resistance changes with temperature and remainingcharge. That modelling may be based on empirical observations of how theinternal resistance changes with temperature and usable capacity. Suchobservations can be built into modelling of the battery.

Thus, improvements in predicting remaining lifetime are desirable,particularly, e.g., for applications where the system battery life isyears, for those batteries that have significant temperature dependence,for those batteries for which the change in output voltage withremaining capacity has very wide flat regions, or for systems that drawsubstantial power at very low duty cycles.

During calibration, the calibration logic is used in determining chargedrawn per pulse (Q_(batCal)) from the battery. The following discussionexplains how Q_(batCal) may be determined during calibration. Ingeneral, when the PFM DC-DC converter is operating in buck mode, thecharge drawn per PFM cycle can be calculated as:

$\begin{matrix}{Q_{out} = \frac{{LI}_{p\; k}^{2}}{2\left( {V_{i\; n} - V_{out}} \right)}} & (1)\end{matrix}$Boost only, or traditional buck/boost would produce different butsimilar formulations that are well understood by those of skill in theart. Note that we only need to know LI_(pk) ² (which is generallysubstantially constant that can be calibrated or measured rarely), andVout, Vin (where Vin is Vbat). Both Vout and Vin are easily measured andchange slowly (battery discharge may change Vin) or a program change maychange Vout, and the computation and control logic 119 should know, oreasily be made aware of a change in Vout.

The charge transferred to the output in each pulse, given a known loadcurrent and a measured PFM frequency is:

$\begin{matrix}{Q_{out} = \frac{I_{load}}{f_{PFM}}} & (2)\end{matrix}$Note that I_(load) and the reference frequency used for the frequencymeasurement may be imperfectly trimmed, or even temperature sensitive.These quantities may be measured in product test, with the measurementresults stored in a one time programmable (OTP) memory, available tomake the charge measurement more accurate. Because the total loadcurrent includes both a calibration load current and a nonzero (andlikely unknown) system load current, two frequency measurements aremade, with two different load currents. One load current includes thecalibration current load and the system current load and the other loadcurrent includes just the system current load. The charge transferred tothe output in each pulse is:

$\begin{matrix}{Q_{out} = \frac{I_{{load}\; 1} - i_{{load}\; 2}}{f_{{PFM}\; 1} - f_{{PFM}\; 2}}} & (3)\end{matrix}$Note that this result depends on the difference in load current betweenthe two calibration operations. An unknown system load current does notaffect the measurement, so long as the unknown system load current doesnot change between the two measurements. Assuming that a good estimateof the efficiency, η, can be made, the charge drawn per pulse from thebattery can be calculated as:

$\begin{matrix}{{Q_{batCal} = \frac{Q_{out}V_{outCal}}{\eta\; V_{batCal}}},} & (4)\end{matrix}$where V_(outCal) is the output voltage during calibration, V_(batCal) isthe battery voltage during calibration, and Q_(out) is the chargetransferred to the output as determined in equation (3). OTP storage ofinformation sufficient to model efficiency well as a function of inputand output voltages and even temperature may be stored in the OTP. OnceQ_(batCal) is known at calibration time, or the values from whichQ_(batCal) can be calculated are known from calibration, Q_(batOp) foroperation at other voltages can be calculated by making use of equation(1) for the case where calibration and operation are both in buck mode,resulting in:

$\begin{matrix}{Q_{batOp} = {Q_{batCal}\frac{V_{batCal} - V_{outCal}}{V_{batOp} - V_{outOp}}}} & (5)\end{matrix}$When the operating mode is not buck in both the calibration measurementand during operation, relationships similar to equation (1) for Qbat inthese operating modes may be used to allow one skilled in the art toderive the appropriate transformation to allow calculation of Q_(batOp)(as in equation 5) when other operating modes are appropriate during thecalibration measurement or during operation. Calibration can be done forLI_(pk) ² once after system powers up for the first time, or could berepeated rarely or when temperature change has become greater than athreshold temperature change since the last calibration. Note inductanceand I_(pk) might change a little with temperature. If predictable andknown, that change can be included in the calculation, or, ifunpredictable, the calibration process can be repeated.

FIG. 2A illustrates an embodiment of the calibration logic 121. Thecalibration hardware includes a selector circuit 201 that selects inputsto supply to analog to digital converter (ADC) 203. The ADC 203digitizes the input voltage (Vbat), the output voltage, and the sensedtemperature. In other embodiments, only Vbat and sensed temperature maybe supplied to ADC 203 or only Vbat and Vout. These quantities changevery slowly, so the ADC operation can be at a low duty cycle so as todraw an average current that is negligibly small. For example, thebattery voltage may be measured every 1000 PFM cycles. The temperaturemay be measured at the same rate or at a different frequency dependingon system needs. In one embodiment, the ADC controller 218, whichcontrols the ADC operation including selecting which voltage to convertto digital and conversion frequency, operates independently, rather thanbeing managed through the communication interface 117. In otherembodiments, the ADC controller 218 may be managed by the computationand control logic 119 through the communications interface 117. Thetemperature may be supplied as a temperature dependent voltage thatcould be from a Vbe voltage, where Vbe is a transistor voltage sensitiveto temperature, or from a temperature sensor on or near the battery. Inlow average power systems, temperature of the integrated circuitcomponents in the system should be close to battery temperature.

The digitized input voltage (Vbat), output voltage, and temperature aresupplied by demultiplexer 205 to the appropriate one of the registersVin 207, register Vout 209, and temperature register 211. Theseregisters are supplied through the communications interface 117 to thecomputation and control logic 119. These values may be utilized bothduring calibration and after calibration to determine both the chargetransferred and to calculate the battery state of charge.

The current load 215 is used in support of the calibration operation.The current load may be implemented as a resistor (or a current source)and may be trimmed in product test to high accuracy. In one embodiment,multiple load settings are used for calibration of LI_(pk) ², e.g., ahigh resistance load for the first count of pulses and a low resistanceload for the second count of pulses, where the second count of pulses ishigher because the PFM rate for the DC-DC converter is higher with thelow resistance load (higher current load). The current load may becontrolled via the communication interface 117. Thus, e.g., as shown inFIG. 2B the communication interface 117 may select the current load byadjusting the variable resistor 231 to a desired resistance value.Initially, the resistance is set to a high value resulting in a firstcurrent load. The variable resistance is then changed to a lowerresistance load resulting in a second current load that is higher thanthe first current load. The higher current load causes the PFM pulserate to be substantially increased to supply added charge required bythe increased current load on the output. The increased pulse rate isused in determining the Q_(batCal) value. Calibration requires modifiedsystem behavior, so in preferred embodiments, the operation is donerarely, possibly only once after startup, or after a substantialtemperature change.

The calibration logic 121 also includes a timer/counter 219 (alsoreferred to herein as an interval counter) and a pulse counter 217 todetermine PFM frequency. The combination of the timer/counter 219 andthe small additional gated pulse counter 217 with AND gate 221 allowsaccurate measurement of the pulse rate during a specific measurementinterval. In one embodiment, the computation and control logic 119 loadsthe timer/counter 219 counts with a count value corresponding to aspecific measurement interval through the communication interface 117and initiates the timing operation. In another embodiment, thetimer/counter 219 may be implemented as a monostable multivibrator toprovide a pulse corresponding to the measurement interval. Thetimer/counter 219 provides an asserted signal during the measurementinterval so pulses are supplied through AND gate 221 to the pulsecounter 217. The computation and control logic 119 retrieves the resultfrom pulse counter 217 at the end of the measurement interval for boththe high current load and the low current load.

In another embodiment to determine PFM frequency, a fixed number ofpulses are counted, interval counter 219 may be enabled over thecommunications interface 117, which in turn allows pulse counter 217 tocount pulses first with the low current load. When the pulse counter hascounted a predetermined number of pulses, e.g., 10 pulses, thetimer/counter is stopped. The process is repeated after the high currentload is switched in and the pulse counter 217 counts 10 pulses while thetimer/counter counts the length of time it takes to count 10 pulses.

FIG. 3 illustrates a flow diagram of an embodiment of the calibrationoperation. In 301, the calibration operation starts by shutting downsystem loads that might draw substantial time-varying current. In anembodiment, the computation and control logic 119 provides control forthe calibration operation. Shutting down system loads that might drawsubstantial time-varying current ensures that the PFM frequency is dueto the added current load 215 rather than system loads that happen to bedrawing substantial time-varying current during the measurementinterval. The calibration operation is typically done rarely, once, ordriven by a change in temperature above a threshold change.

In step 303, the resistance load is set to a high resistance for a lowcurrent load. In 305 the first PFM frequency is determined with the lowcurrent load. As mentioned earlier, the value of the low current loadmay be determined in product test. In step 306, the calibrationoperation sets the variable resistance to a low resistance resulting ina higher current load. In step 307, the second PFM frequency isdetermined with the second load current. As mentioned earlier, the valueof the high current load may be determined in product test. In step 308the calibration current load may be set to an operational setting. Instep 309, the computation and control logic calculates the chargedelivered per pulse to the load (Q_(out)), e.g., in accordance withequation (3) above.

In an optional step 311, the computation process may use a lookup tableor interpolation to estimate efficiency as function of the batteryvoltage V_(bat) and/or temperature. Efficiency is the ratio of powerout/power in for the PFM DC-DC converter. In other embodiments, a fixedestimated value for efficiency may be used. Finally, in 315, the chargeper pulse delivered to the load is referred back to the battery and thecharge drawn per pulse from the battery during calibration is calculatedin accordance with equation (4) above.

The calibration operation represented in equations (3) and (4) worksindependently of whether the PFM DC-DC converter is operating in buck,boost, or buck/boost mode. The calibration operation works so long asany change in system load current between the two PFM measurements issmall relative to I_(calLoad) or the change in system load is smallbetween measuring an equal number of pulses. Satisfying that generallydepends on ensuring that system loads that might draw substantialtime-varying current are turned off. That is generally possible (atleast on startup) in small systems under the control of the computationand control logic implemented, e.g., on an MCU that provides systemcontrol. In systems under some other control, ensuring system loads thatmight draw substantial time-varying current are off, may not bepossible.

As the battery ages, the battery voltage V_(bat) changes and so thecharge drawn per pulse from the battery changes during operation. Inorder to accurately track the battery state of charge, every time thestate of charge is measured, the input voltage Vbat during operationneeds to be known. Although Vbat changes slowly, the measurement of Vbathas to be performed frequently enough to maintain the desired accuracyof the state of charge calculation. Similarly, if the output voltagegenerated by the DC-DC changes during operation, the calculation forcharge drawn per pulse is affected. Once the charge drawn per pulsedetermined during calibration is known, Q_(batCal), the charge drawn perpulse during operation (Q_(batOp)) can be determined in accordance withequation (5) above, where the calibration mode and operational mode areboth buck.

If the original mode and original voltages are known, the charge drawnper pulse (Q_(batOp)) in other modes or at other voltages can becalculated when needed. For example, the charge drawn per PFM cycle inboost mode is:

$\begin{matrix}{Q_{out} = {\frac{{LI}_{p\; k}^{2}}{2}\left( \frac{V_{out}}{V_{i\; n}\left( {V_{out} - V_{i\; n}} \right)} \right)}} & (6)\end{matrix}$Combining equation (6) and equation (1), charge per pulse drawn from thebattery in boost mode may be determined from the calibration done inbuck mode as follow:

$\begin{matrix}{Q_{batOp} = {Q_{batCal}\frac{V_{outop}}{V_{batOp}}\frac{V_{batCal} - V_{outCal}}{{VoutOp} - {VbatOp}}\frac{I_{pkOp}^{2}}{I_{pkCal}^{2}}}} & (7)\end{matrix}$While equations 6 and 7 illustrate how calibration can be done in buckmode and used to determine charge drawn in boost mode, more generally,calibration can be performed in one mode, e.g., buck, boost, orbuck-boost, and used in determining charge drawn in the same or anotheroperating mode, e.g., buck, boost, or buck-boost. That can beparticularly advantageous because a system may start out operating inone mode, e.g., buck mode, and then switch to boost mode as the batteryages.

Note that equation (7) does not assume that I_(pk) remains constantbetween calibration and operation conditions. The possible change inpeak inductor current results in the last multiplicative term above inequation (7). In contrast, when calculating Q_(batOp) (equation (5))when both calibration and operating modes were buck, the assumption wasmade that the peak inductor current does not change with temperature.The calculations to determine Q_(batOp) may assume the peak inductorcurrent does not change with temperature or battery voltage. The extentto which the peak inductor current does change with temperature and/orbattery voltage will constitute a source of error in the gain of thecharge measurement system, unless an estimate of such sensitivity isincluded in the calculation of Q_(batOp).

Because of limited knowledge of the initial state of charge of a batterysuch as battery quality, age, and manufacturer, coulomb countingapproaches described herein may be backstopped in some embodiments by avoltage measurement based state of charge estimation. The best state ofcharge estimate from Coulomb counting may be used when open circuitmeasurements indicate the battery is not near end of life. The state ofcharge estimate from open circuit voltage measurements may be used whenopen circuit measurements indicate the battery is nearing end of life.

The computation and control process, which may be implemented as MCUfirmware, may include an application programming interface (API) forcalling the calibration operation (e.g., called once per batteryinsertion). In addition, an API for servicing may be called a largenumber of times throughout the life of the battery (e.g., 100 times) toread the rolling counter 111 (through the snapshot register 115), andread input voltage, output voltage (if needed), and temperature fromregisters 207, 209, and 211, respectively. Based on those values, thecomputation process calculates the charge drawn for the current count ofpulses during regular operation (as opposed to calibration), and basedon the charge drawn operationally and the number of pulses, can computethe state of charge of the battery. The computation logic may utilizetemperature in calculating estimates for how I_(pk) may change as afunction of temperature. The computation logic may also utilize an opencircuit voltage (OCV) state of charge approach based on a batteryvoltage measurement. The computation process may look up an OCV-basedstate of charge from a table based on the open circuit voltage,temperature, and loading. The various state of charge estimates may becombined and used to produce a best guess at a single state of chargeand battery lifetime remaining.

For some battery types, the open circuit voltage does not drop much withbattery state of charge, but the battery internal resistance can risesignificantly. For example, the internal resistance of LiMnO2 batteriesrises approximately seven fold before the battery is completelydepleted. That is also generally true of LTC batteries. In order tobetter handle batteries with such characteristics, as shown in FIG. 2C,three registers may be maintained to represent the battery voltage Vbat.One Vbat register 225 stores the maximum value of Vbat seen since thelast time the register was cleared. A second Vbat register 227 maintainsthe minimum value of Vbat seen the since last time the second Vbatregister was cleared. The maximum and minimum registers may be clearedperiodically, so that a particular event, e.g., a cold snap, does notcontinue to affect current minimum or maximum values. A third Vbatregister 229 stores an average battery voltage and may function as aninfinite impulse response (IIR) first order filter, to yield the averagebattery voltage. Average battery voltage should be used for theQ_(batOp) calculations. The maximum-minimum difference shows how batteryvoltage is changing versus time due to the pulsed nature of the load.For some battery chemistries, the maximum-minimum difference may be moreuseful for predicting battery state of charge than use of the opencircuit voltage. The maximum battery value provides the best estimate touse for open circuit voltage based state of charge estimates. Theminimum battery value is the ultimate warning of shutdown. When theminimum voltage drops below a predetermined limit, a flag may be setindicating the minimum voltage condition, and warning sent to thecontrol logic.

Temperature has been described above as effecting, e.g., usable batterycharge. Temperature can also have second order effects that may beaccounted for in some embodiments. The resistance of the switch (to turnon/off inductor current), resistance of the inductor, and hookupresistance can become very important when Vin-Vout of the DC-DCconverter is small. The charging of current in the inductor is reallyonly approximately linear in time when the time is much smaller than thetime constant of the charging circuit (L/R_(total)). WhenI_(pk)*R_(total) is not much less than the |Vin−Vout|, the time tocharge the inductor to I_(pk) (and therefore the charge transferredduring that time) is not independent of R_(total). Corrections toaccount for nonzero R, and the resistance value can be stored in OTP(thus available to the calculation). In addition, the total resistanceis generally quite temperature sensitive.

As mentioned above, the value of I_(pk) is expected to change somewhatwith temperature. The comparator that senses when the inductor currentreaches the desired value may be offset cancelled, but has nonzerodelay. The delay causes the inductor to be switched later than ideal,resulting in an increase in I_(pk) which is proportional to the delaydivided by the current slew rate (V_(charge)/L). The whole error dependson temperature (due to delay changing with temperature) and with voltage(affects both the delay and the V_(charge)). Corrections for dependenceof I_(pk) on temperature and voltage can be included in someembodiments.

In another embodiment, rather than use the calibration approachdescribed in FIGS. 2 and 3, another calibration approach uses a modifiedIR drop calibration approach as illustrated in FIGS. 4 and 5. Referringto FIG. 4, the portion of the figure above the battery 401 is similar tothe calibration hardware shown in FIG. 2 for the known currentload-based calibration. The portion in dotted lines including precisionsense resistor 403, ADC 405, and integrator 407 illustrate the analogfront end (AFE) of an IR drop measuring system. During calibration, theintegrator 407 integrates the voltage across the precision resistor 403.In the embodiment illustrated in FIG. 4, the IR drop measuring system isused only in calibration, and only when the current load 409 is enabled.In an embodiment, the current load 409 may be implemented as anapproximately 10 mA current source that is enabled during calibration ora switched resistor to cause an additional approximately 10 mA loadingwhen the resistance load is coupled through a switch (not shown) to theoutput of the voltage converter so as to cause the higher current load(lower output resistance). If the current load is sufficiently high, theIR drop measured across the sense resistor 403 is much larger than theresidual offset of the ADC 405. Therefore, the residual offset hasnegligible effect on the accuracy. In an embodiment, the ADC may bechopped to help achieve an effective offset <=10 uV.

The ADC 405 may be conveniently implemented as a ΣΔ analog to digitalconverter, which has a high sampling rate, allowing for minimalanti-alias filtering, and is consistent with a fast calibrationoperation. The integrator 407 should be started/stopped in sync with thetimer/counter 419, so that the integrated IR drop signal (which mayinclude a changing load current in contrast to the calibration approachof FIG. 2) corresponds exactly to the counted pulses. With the currentsource or switched resistor enabled, total current draw is enough toproduce an IR drop that is >1 mV, and is >>residual offset of the IRbased measurement system. Thus, e.g., V_(IR) is at least one or twoorders of magnitude greater than the residual offset voltage. IR basedmeasurement is a true representation of average current draw during themeasurement interval, with offset causing error <1%.

FIG. 5 illustrates steps of an embodiment of the IR drop calibrationapproach. As noted above, the control logic (e.g., the MCU) does notneed to shut down system loads which might draw substantial time-varyingcurrent. The load current should be

${V_{IR} = {{R_{sense}I_{bat}} = {{{R_{sense}\left( {I_{calLoad} + I_{otherLoads}} \right)}\frac{V_{out}}{{eff} \cdot V_{bat}}} ⪢ V_{residOffset}}}},$where V_(IR) is the voltage across the sense resistor, R_(sense) is theresistance of the sense resistor, I_(bat) is the current from thebattery, I_(calLoad) is current through the calibration current load,I_(otherLoads) is current through other loads of the system, eff isefficiency, and V_(residOffset) is the residual offset voltage. In 501the measurement interval (T_(meas)) is started by the calibration logic.In 503 the calibration logic counts number of PFM pulses (N_(PFM)) inthe measurement interval (T_(meas)), and in 505 the calibration logicmeasures the IR drop and integrates the IR drop during the measurementinterval. The measurement interval T_(meas) may be, e.g., 2 ms, duringwhich approximately 400 PFM pulses are generated, and in an embodimentresults in an error of less than 0.25%. Finally, in 507 the charge drawnper pulse from the battery, Q_(batCal), is determined. The charge drawnper pulse from the battery may be calculated as

${Q_{batCal} = \frac{V_{IR}T_{meas}}{N_{PFM}R_{sense}}},$where V_(IR)/R_(sense) is the current, and assuming V_(IR) representsthe average, then (V_(IR)×T_(meas)/R_(sense)) is the total charge drawnduring the measurement interval, and dividing by N_(PFM) provides chargeper pulse.

If more than one PFM mode DC-DC converter is present in the system (forexample, there may be multiple supply voltages with one DC-DC converterper supply voltage), the operation above may be repeated for each DC-DCconverter with a current load enabled for each DC-DC converter output inturn. With M DC-DC converters present, the calibration logic solves Mequations to obtain a value of Q_(bat) for each DC-DC converter.

Because the modified IR drop calibration approach does not requireshutting down other system loads during the IR drop calibration, it ispossible to calibrate often enough so that changes in temperature andVbat, which would change Q_(bat), may be tracked directly withoutmonitoring changes in Vout and Vbat. Further, because the embodiment ofFIG. 4 allows for calibration when the containing system is not halted,calibration can occur even when the system is not under the control oflocal control logic, which prevents system loads from being disabled. Itis also not necessary to estimate changes in peak current withtemperature, monitor temperature, and recalculate Q_(bat) as a functionof temperature when temperature changes. In addition, because the IRdrop measurement is made in series with the battery, no estimatedefficiency (which may not be precisely known) shows up in the equationsfor Q_(batCal) determined using the second calibration approach.

Thus, this second calibration approach can be used to generate acalibration charge drawn per PFM pulse from the battery and thecompensation and control logic 119 (see FIG. 1) can be used to generatethe charge used operationally based on the calibration value ofQ_(batCal) and using equations such as equation (5) and knowing Vbat andVout values during operation. Alternatively, the IR calibration approachcan be run often enough to account for a change in Vbat, or in responseto a change in Vbat above a respective threshold or when the system ismade aware of a change in Vout.

FIG. 6 illustrates another perspective of an embodiment of a system togenerate battery state of charge and the total charge drawn from thebattery. The calibration operation 601 may be implemented in accordancewith the embodiments of FIG. 2A or FIG. 4. The calculation 603determines the charge per pulse drawn from the battery (Q_(batOp))observed during operation and records the value, along with the relevantvoltages (e.g., V_(bat) and V_(out)) and the mode (e.g., buck, boost, orbuck-boost) during the calculation operation. The calculation 603produces Q_(batOp) as a function of the current conditions, e.g.,V_(bat) and V_(out), the Q_(batCal) measured during the calibrationoperation, and the conditions, e.g., V_(batcal) and V_(outcal) duringthe calibration operation.

All operations in the diagram are done sufficiently rarely so as to drawnegligible average power and sufficiently often that count supplied bypulse counter 111 (see FIG. 1) does not overflow more than once. In anembodiment counter overflow may occur every 35 minutes at full loadcurrent. The combination of delay 605 and the subtraction process 607produces the change in count since the last calculation. The change incount is supplied to the multiplier 609, which multiplies the pulsecount multiplied by the charge drawn from the battery per pulse togenerate charge drawn for the current count 610 and supplies that valueto the integrator 611, which integrates the charge drawn for the currentcount 610 to supply the total charge supplied by the battery 615.

Thus, various aspects have been described relating to determiningbattery charge drawn and battery charge remaining. The description ofthe invention set forth herein is illustrative, and is not intended tolimit the scope of the invention as set forth in the following claims.Other variations and modifications of the embodiments disclosed herein,may be made based on the description set forth herein, without departingfrom the scope of the invention as set forth in the following claims.

What is claimed is:
 1. A method comprising: providing a calibrationcurrent load on an output of a pulse frequency modulated (PFM) DC-DCconverter during at least a part of a calibration operation;determining, based on the calibration operation, a calibration chargedrawn per pulse from a battery supplying an input voltage to a pulsefrequency modulated (PFM) DC-DC converter; determining an operationalbattery voltage; during operation, counting a number of pulsescorresponding to switching events that occur in the PFM DC-DC converterassociated with the operational battery voltage; and determining chargedrawn from the battery during the number of pulses, based at least inpart on, the operational battery voltage, the calibration charge drawnper pulse, and the number of pulses.
 2. The method as recited in claim 1further comprising determining battery state of charge based, at leastin part, on the charge drawn from the battery during the number ofpulses.
 3. The method as recited in claim 2 further comprising: sensingtemperature and providing a sensed temperature; and determining thebattery state of charge, based at least in part, on the sensedtemperature.
 4. The method as recited in claim 1 further comprisingdetermining the charge drawn from the battery during the number ofpulses, based at least in part, on a current output voltage of the DC-DCconverter and a calibration output voltage of the DC-DC converterdetermined during the calibration operation.
 5. The method as recited inclaim 1 further comprising determining the charge drawn from the batteryduring the number of pulses, based in part, on a current operating modeof the PFM DC-DC converter.
 6. The method as recited in claim 5 furthercomprising: performing the calibration operation in a first operatingmode; and determining the charge drawn from the battery during thenumber of pulses while operating in the current operating mode that isdifferent than the first operating mode.
 7. The method as recited inclaim 1 further comprising storing a battery voltage value correspondingto a maximum battery voltage, a minimum battery voltage, and an averagebattery voltage.
 8. The method as recited in claim 7 further comprisingusing the average battery voltage for determining the operationalbattery voltage.
 9. The method as recited in claim 1 wherein determiningthe calibration charge drawn per pulse further comprises: determining afirst PFM frequency with a first current load on the output of the PFMDC-DC converter during the calibration operation; determining a secondPFM frequency with the calibration current load configured to provide asecond current load on the output of the PFM DC-DC converter during thecalibration operation, the second current load being higher than thefirst current load and the first PFM frequency being lower than thesecond PFM frequency; and determining the calibration charge drawn perpulse based in part on the first PFM frequency and the second PFMfrequency.
 10. The method as recited in claim 1 wherein determining thecalibration charge drawn per pulse further comprises: enabling thecalibration current load; counting a calibration number of pulses in ameasurement interval; sensing a voltage across a resistor in series withthe battery during the measurement interval; and integrating the voltageacross the resistor over the measurement interval and providing anintegrated voltage; and determining the calibration charge drawn perpulse from the battery, using the number of pulses, the integratedvoltage, and a resistance value of the resistor.
 11. An apparatuscomprising: a pulse frequency modulated (PFM) DC-DC converter; logic todetermine, based on a calibration operation, a calibration charge drawnper pulse from a battery supplying an input voltage to the PFM DC-DCconverter; a calibration current load controlled to be added to a systemcurrent load during at least a part of the calibration operation toprovide an increased current load seen by the PFM DC-DC converter; acounter to count a number of pulses corresponding to switching eventsthat occur in the PFM DC-DC converter during operation associated withan operational battery voltage; and wherein the logic is configured todetermine charge drawn from the battery during the number of pulses,based at least in part on, the operational battery voltage, thecalibration charge drawn per pulse, and the number of pulses.
 12. Theapparatus as recited in claim 11 wherein the apparatus is configured todetermine battery state of charge based, at least in part, on the chargedrawn from the battery during the number of pulses.
 13. The apparatus asrecited in claim 11 further comprising: a temperature sensor to providea sensed temperature; and wherein the logic is further configured todetermine state of charge of the battery, based at least in part, on thesensed temperature.
 14. The apparatus as recited in claim 11 wherein thelogic is further configured to determine the charge drawn from thebattery during the number of pulses, based at least in part, on acurrent output voltage of the DC-DC converter and a calibration outputvoltage of the DC-DC converter determined during the calibrationoperation.
 15. The apparatus as recited in claim 11 wherein the logic isconfigured to determine the charge drawn from the battery during thenumber of pulses, based in part, on a current operating mode of the PFMDC-DC converter.
 16. The apparatus as recited in claim 15: wherein thecalibration operation is performed in a first operating mode; andwherein the charge drawn from the battery during the number of pulses isdetermined while operating in the current operating mode, which isdifferent than the first operating mode.
 17. The apparatus as recited inclaim 11 further comprising: first storage to store a maximum batteryvoltage, second storage to store a minimum battery voltage, and a thirdstorage to store an average battery voltage.
 18. The apparatus asrecited in claim 17 wherein the average battery voltage is used todetermine the operational battery voltage.
 19. The apparatus as recitedin claim 11 further comprising: a variable current load including avariable resistance set to a first resistance corresponding to a lowcurrent load to determine a first PFM frequency with the low currentload and wherein the variable current load is set to a secondresistance, lower than the first resistance, and corresponding to theincreased current load provided by the calibration current load, todetermine a second PFM frequency with the increased current load,wherein the calibration charge drawn per pulse from the battery isdetermined based in part on the first PFM frequency and the second PFMfrequency.
 20. The apparatus as recited in claim 11 further comprising:control logic to enable the increased current load; a counter to count acalibration number of pulses in a measurement interval; a resistor inseries with the battery; and an integrator to integrate a voltage acrossthe resistor over the measurement interval and provide an integratedvoltage; and wherein the calibration charge drawn per pulse from thebattery is determined using the number of pulses, the integratedvoltage, and a resistance value of the resistor.